﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Drawing;

public partial class ShowImage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int intId = -1;

        if (Request.QueryString["id"] != null)
        {
            intId = Int32.Parse(Request.QueryString["id"]);
        }
        else
        {
            return;
        }
        LinQ_RaoVatDataContext ct = new LinQ_RaoVatDataContext();
        TIN_RAO_VAT raovat = ct.TIN_RAO_VATs.Where(r=>r.MaTinRaoVat == intId).FirstOrDefault();
        if(raovat == null )
            return;

        if(raovat.Thumbnail == null)
        {
            
        }
        else
        {
            if (raovat.Thumbnail.Length > 0)
            {
                          
                Response.ContentType = "image/jpeg";
                Response.OutputStream.Write(raovat.Thumbnail.ToArray(), 0, raovat.Thumbnail.Length);
                Response.Flush();
            }
            else
            {
              
            }
           
        }
        

    }
}
